#ifndef AUDIOPLAYER_H
#define AUDIOPLAYER_H

#include <QObject>
#include "v_utils.h"

void audio_callback(void *userdata, Uint8 *stream, int len);

class AudioPlayer : public QObject
{
    Q_OBJECT
    Video* v;
public:
    uint8_t buffer[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
    unsigned int buf_size;
    unsigned int buf_index;
    unsigned int pkt_size;
    AVPacket curpkt;

    AudioPlayer(QObject *parent = 0, Video* v = 0);
    ~AudioPlayer();

    int audio_decode_frame(uint8_t *audio_buf, int buf_size, double *pts_ptr);

    unsigned int getVolume();
    VideoState getState();
};

#endif // AUDIOPLAYER_H
